package com.example.poverty.service.impl;

import com.example.poverty.entity.Cadre;
import com.example.poverty.dao.CadreMapper;
import com.example.poverty.service.CadreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 前端驻村干部service实现类
 */
@Service
public class CadreServiceImpl implements CadreService {

    @Autowired
    private CadreMapper cadreMapper;

    @Override
    public boolean insert(Cadre cadre) {
        return cadreMapper.insert(cadre) > 0;
    }

    @Override
    public boolean update(Cadre cadre) {
        return cadreMapper.update(cadre) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return cadreMapper.delete(id) > 0;
    }

    @Override
    public Cadre selectByPrimaryKey(Integer id) {
        return cadreMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Cadre> allCadre() {
        return cadreMapper.allCadre();
    }

    @Override
    public Cadre getByName(String name) {
        return cadreMapper.getByName(name);
    }


    @Override
    public boolean verifyPassword(String username, String password) {
        return cadreMapper.verifyPassword(username, password) > 0;
    }
}
